Skip to content

Conversation

@mwcraig
Copy link
Member

@mwcraig mwcraig commented Jul 8, 2025

This removes the image_height and image_width properties. These things are determined by the image that is loaded.

This also checks that every method/property in the interface and the sample implementation has a docstring.

@mwcraig mwcraig requested a review from Copilot July 8, 2025 18:06

This comment was marked as outdated.

@mwcraig mwcraig requested a review from Copilot July 8, 2025 20:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the now-unnecessary image_width and image_height attributes from the interface and implementation, and adds enforcement that every method/property has a docstring via a new decorator and tests.

  • Deleted image_width/image_height from the protocol and logic classes.
  • Introduced docs_from_interface decorator to copy docstrings from the interface.
  • Added tests ensuring all interface methods/attributes have docs.
  • Replaced hard-coded image dimensions in tests with DEFAULT_IMAGE_SHAPE.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/test_astro_image_display_api.py Added test_every_method_attribute_has_docstring.
src/astro_image_display_api/interface_definition.py Removed image_width and image_height attributes from protocol.
src/astro_image_display_api/image_viewer_logic.py Added docs_from_interface decorator; removed manual __doc__ assignments.
src/astro_image_display_api/api_test.py Introduced DEFAULT_IMAGE_SHAPE; updated fixtures and tests; removed width/height tests.
Comments suppressed due to low confidence (2)

src/astro_image_display_api/api_test.py:21

  • [nitpick] The tuple DEFAULT_IMAGE_SHAPE is ambiguous (height vs width); consider using separate constants or renaming (e.g. DEFAULT_IMAGE_HEIGHT and DEFAULT_IMAGE_WIDTH) for clarity.
DEFAULT_IMAGE_SHAPE = (100, 150)

src/astro_image_display_api/image_viewer_logic.py:56

  • The decorator references ImageViewerInterface but there’s no import in this file; please add from astro_image_display_api.interface_definition import ImageViewerInterface at the top.
def docs_from_interface(cls):

)


def test_every_method_attribute_has_docstring():
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This test is duplicated in api_test.py; consider extracting a shared helper or fixture to avoid copy–paste.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is deliberate. One is used internally, one is meant to be used externally.

@mwcraig mwcraig merged commit 5373307 into astropy:main Jul 8, 2025
7 checks passed
@mwcraig mwcraig deleted the remove-image-attributes branch July 8, 2025 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant